/***************Player class*******************
 * has Property class objects in ArrayList defined in GameLot.java
 */
//TO-DO add buildHouse/hotel method & removeHouse/hotel method
import java.util.*;

public class Player
{
	private String playerName; // name entered at start of game
	private int cash; // how much money is in the player's bank account (cash on hand)
	private boolean jailFreeChance, jailFreeCommChest; // has card = true, doesn't have card = false
	private boolean inJail; // in jail = true, not in jail = false;
	private int jailTurns; // number of turns player has spent in jail (on a single trip)
	private int doublesRolled; // number of times doubles has been rolled on a players turn (3 times: go to jail)
	private int playerType; // human = 1; computer = 0;
	private int playerNumber; // number in order of play (1, 2, 3, or 4 assigned at game start)
	
	private int totalWealth;
	
	private int[] groups; // array to keep up with color groups owned -  MAYBE NOT NEEDED b/c of ownership array???
	// [0] - DarkPurple group, [1] - LightBlue group,   [2] - LightPurple group,  [3] - Orange group
	// [4] - Red group,    	   [5] - Yellow group, 		[6] - Green group, 		  [7] - DarkBlue group
	// [8] - Utilities,	   	   [9] - Railroads
	private final int NUMCOLORGROUPS = 10;
	
	
	private ArrayList<GameLot> DarkPurpleList;
	private ArrayList<GameLot> LightBlueList;
	private ArrayList<GameLot> OrangeList;
	private ArrayList<GameLot> YellowList;
	private ArrayList<GameLot> GreenList;
	private ArrayList<GameLot> DarkBlueList;
	private ArrayList<GameLot> RedList;
	private ArrayList<GameLot> LightPurpleList;
	private ArrayList<GameLot> UtilityList;
	private ArrayList<GameLot> RailRoadList;
	
	private int[] ownership; // array to keep up with how many of each property per group is owned
	// [0] - DarkPurple, 0-2,	 	[1] - LightBlue, 0-3,		[2] - LightPurple, 0-3,		[3] - Orange, 0-3,
	// [4] - Red, 0-3,			 	[5] - Yellow, 0-3,			[6] - Green, 0-3,			[7] - DarkBlue, 0-2,
	// [8] - White(utilities), 0-2,	[9] - Black(railroads), 0-4
	
	private int location; // 0 - 39; 0 = GO, ... 39 = BOARDWALK
	private final int NUMBOARDLOCATIONS = 40;
	
	public Player()
	{
		cash = 1500;
		totalWealth = cash;
		jailFreeChance = false;
		jailFreeCommChest = false;
		inJail = false;
		jailTurns = 0;
		doublesRolled = 0;
		
		groups = new int[NUMCOLORGROUPS];
		ownership = new int[NUMCOLORGROUPS];
		location = 0;
		DarkPurpleList = new ArrayList();
		this.LightBlueList = new ArrayList();
		this.LightPurpleList = new ArrayList();
		this.RedList = new ArrayList();
		this.YellowList = new ArrayList();
		this.DarkBlueList = new ArrayList();
		this.DarkPurpleList = new ArrayList();
		this.GreenList = new ArrayList();
		this.OrangeList = new ArrayList();
		this.UtilityList = new ArrayList();
		this.RailRoadList = new ArrayList();
		
		for(int i=0; i<NUMCOLORGROUPS; i++)
		{
			groups[i] = 0;
		}
		
		for(int i=0; i<NUMCOLORGROUPS; i++)
		{
			ownership[i] = 0;
		}		
	} // end constructor
	public void setPlayerName(String name)
	{
		playerName = name;
	} // end
	public String getPlayerName()
	{
		return playerName;
	} // end
	public void setPlayerNumber(int num)
	{
		// num can be 1, 2, 3, or 4
		playerNumber = num;
	} // end
	public int getPlayerNumber()
	{
		return playerNumber;
	} // end 
	public void addCash(int value)
	{
		cash += value;
	} // end 
	public void subtractCash(int value)
	{
		cash -= value;
	} // end 
	public int getCash()
	{
		return cash;
	} // end 
	public boolean getJailFreeChance()
	{
		return jailFreeChance;
	} // end 
	public void setJailFreeChance(boolean value)
	{
		jailFreeChance = value;
	} // end 
	public boolean getJailFreeCommChest()
	{
		return jailFreeCommChest;
	} // end 
	public void setJailFreeCommChest(boolean value)
	{
		jailFreeCommChest = value;
	} // end 
	public boolean getJailState()
	{
		return inJail;
	} // end
	public void setJailState(boolean value)
	{
		inJail = value;
	} // end 
	public int getJailTurns()
	{
		return jailTurns;
	}
	public void increaseJailTurns()
	{
		jailTurns++;
	}
	public void resetJailTurns()
	{
		jailTurns = 0;
	}
	public int getDoublesRolled()
	{
		return doublesRolled;
	}
	public void increaseDoublesRolled()
	{
		doublesRolled++;
	}
	public void resetDoublesRolled()
	{
		doublesRolled = 0;
	}
	public void setPlayerType(int type)
	{
		playerType = type;
	}
	public int getPlayerType()
	{
		return playerType;
	}
	public void setLocation(int loc)
	{
		location = loc % NUMBOARDLOCATIONS;
	}
	public int getLocation()
	{
		return location;
	}
	public void addTotalWealth(int num){
		this.totalWealth += num;
	}
	public void subtractTotalWealth(int num){
		this.totalWealth -= num;
	}
	/*
	(1) Cash on hand 
	(2) Lots, Utilities and Railroads owned, at the price printed on the board.
	(3) Any mortgaged property owned, at one-half the price printed on the board. 
	(4) Houses, valued at purchase price.
	(5) Hotels, valued at purchase price including the value of the*/
	public int getTotalWealth(){
		int totalWealth = 0;
		totalWealth += cash;
		
		for(int i = 0; i<this.DarkPurpleList.size(); i++){
			GameLot curLot = DarkPurpleList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.LightBlueList.size(); i++){
			GameLot curLot = LightBlueList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else
				totalWealth += curLot.getMortgageValue();
		}
		for(int i = 0; i<this.LightPurpleList.size(); i++){
			GameLot curLot = LightPurpleList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.OrangeList.size(); i++){
			GameLot curLot = OrangeList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.RedList.size(); i++){
			GameLot curLot = RedList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.YellowList.size(); i++){
			GameLot curLot = YellowList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.GreenList.size(); i++){
			GameLot curLot = GreenList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.DarkBlueList.size(); i++){
			GameLot curLot = DarkBlueList.get(i);
			String name = curLot.getName();
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
				if(curLot.hotelOwned() == true){
					totalWealth += curLot.getBuildCost() * 5;
				}
				else{
					totalWealth += curLot.getNumHouses() * curLot.getBuildCost();
				}
			}
			else{
				totalWealth += curLot.getMortgageValue();
				
			}
		}
		for(int i = 0; i<this.UtilityList.size(); i++){
			GameLot curLot = UtilityList.get(i);
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
			}
			else
				totalWealth += curLot.getMortgageValue();
		}
		for(int i = 0; i<this.RailRoadList.size(); i++){
			GameLot curLot = RailRoadList.get(i);
			if(curLot.isMortgaged() == false){
				
				totalWealth += curLot.getPrice();
			}
			else
				totalWealth += curLot.getMortgageValue();
		}
		
		
		return totalWealth;
	}
	
	public void addNewProperty(GameLot gl)
	{
		if(gl.getColor() == "DarkPurple")
			this.DarkPurpleList.add(gl);
		else if(gl.getColor() == "LightBlue")
			this.LightBlueList.add(gl);
		else if(gl.getColor() == "LightPurple")
			this.LightPurpleList.add(gl);
		else if(gl.getColor() == "Orange")
			this.OrangeList.add(gl);
		else if(gl.getColor() == "Red")
			this.RedList.add(gl);
		else if(gl.getColor() == "Yellow")
			this.YellowList.add(gl);
		else if(gl.getColor() == "Green")
			this.GreenList.add(gl);
		else if(gl.getColor() == "DarkBlue")
			this.DarkBlueList.add(gl);
		else if(gl.getColor() == "White")
			this.UtilityList.add(gl);
		else if(gl.getColor() == "Black")
			this.RailRoadList.add(gl);
		
		
	}
	
	public void addNewProperty(String name){
		GameLot pi = new GameLot(name);//for testing
		String col = pi.getColor();
		
		if(col == "DarkPurple")
			this.DarkPurpleList.add(pi);
		else if(col == "LightBlue")
			this.LightBlueList.add(pi);
		else if(col == "LightPurple")
			this.LightPurpleList.add(pi);
		else if(col == "Orange")
			this.OrangeList.add(pi);
		else if(col == "Red")
			this.RedList.add(pi);
		else if(col == "Yellow")
			this.YellowList.add(pi);
		else if(col == "Green")
			this.GreenList.add(pi);
		else if(col == "DarkBlue")
			this.DarkBlueList.add(pi);
		else if(col == "White")
			this.UtilityList.add(pi);
		else if(col == "Black")
			this.RailRoadList.add(pi);
	}
	public void removeProperty(String name)
	{
		for(int i = 0; i< this.getDarkPurpleSize();i++){
			if(this.getDarkPurpleNameAt(i).equals(name)){
				this.DarkPurpleList.remove(i);
			}
		}
		for(int i = 0; i< this.getLightBlueSize();i++){
			if(this.getLightBlueNameAt(i).equals(name)){
				this.LightBlueList.remove(i);
			}
		}
		for(int i = 0; i< this.getLightPurpleSize();i++){
			if(this.getLightPurpleNameAt(i).equals(name)){
				this.LightPurpleList.remove(i);
			}
		}
		for(int i = 0; i< this.getOrangeSize();i++){
			if(this.getOrangeNameAt(i).equals(name)){
				this.OrangeList.remove(i);
			}
		}
		for(int i = 0; i< this.getRedSize();i++){
			if(this.getRedNameAt(i).equals(name)){
				this.RedList.remove(i);
			}
		}
		for(int i = 0; i< this.getYellowSize();i++){
			if(this.getYellowNameAt(i).equals(name)){
				this.YellowList.remove(i);
			}
		}
		for(int i = 0; i< this.getGreenSize();i++){
			if(this.getGreenNameAt(i).equals(name)){
				this.GreenList.remove(i);
			}
		}
		for(int i = 0; i< this.getDarkBlueSize();i++){
			if(this.getDarkBlueNameAt(i).equals(name)){
				this.DarkBlueList.remove(i);
			}
		}
		for(int i = 0; i< this.getUtilitySize();i++){
			if(this.getUtilityNameAt(i).equals(name)){
				this.UtilityList.remove(i);
			}
		}
		for(int i = 0; i< this.getRailroadSize();i++){
			if(this.getRailroadNameAt(i).equals(name)){
				this.RailRoadList.remove(i);
			}
		}
	}
	
	//how many houses of the property are there?
	public int getNumberOfHouses(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				return this.DarkPurpleList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				return this.LightBlueList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				return this.LightPurpleList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				return this.OrangeList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				return this.RedList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				return this.GreenList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				return this.YellowList.get(i).getNumHouses();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				return this.DarkBlueList.get(i).getNumHouses();
		}
		return 0;
	}
	public int getNumberOfHouses(String nameOfProperty, String color){
		
		if(color == "DarkPurple"){
			for(int i = 0;  i<this.DarkPurpleList.size() ; i++)
			{
				if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				{
					return this.DarkPurpleList.get(i).getNumHouses();
				}
			}
		}
		else if(color == "LightBlue"){
			for(int i = 0;  i<this.LightBlueList.size() ; i++)
			{
				if(nameOfProperty == this.LightBlueList.get(i).getName())
				{
					return this.LightBlueList.get(i).getNumHouses();
				}
			}
		}
		else if(color == "LightPurple"){
			for(int i = 0;  i<this.LightPurpleList.size() ; i++)
			{
				if(nameOfProperty == this.LightPurpleList.get(i).getName())
				{
					return this.LightPurpleList.get(i).getNumHouses();
				}
			}
		}
		else if(color == "Orange"){
			for(int i = 0;  i<this.OrangeList.size() ; i++)
			{
				if(nameOfProperty == this.OrangeList.get(i).getName())
				{
					return this.OrangeList.get(i).getNumHouses();
				}
			}
		}
			
		else if(color == "Red"){
			for(int i = 0;  i<this.RedList.size() ; i++)
			{
				if(nameOfProperty == this.RedList.get(i).getName())
				{
					return this.RedList.get(i).getNumHouses();
				}
			}
		}
		else if(color == "Green"){
			for(int i = 0;  i<this.GreenList.size() ; i++)
			{
				if(nameOfProperty == this.GreenList.get(i).getName())
				{
					return this.GreenList.get(i).getNumHouses();
				}
			}
		}
		else if(color == "Yellow"){
			for(int i = 0;  i<this.YellowList.size() ; i++)
			{
				if(nameOfProperty == this.YellowList.get(i).getName())
				{
					return this.YellowList.get(i).getNumHouses();
				}
			}
		}
		else if(color == "DarkBlue"){
			for(int i = 0;  i<this.DarkBlueList.size() ; i++)
			{
				if(nameOfProperty == this.DarkBlueList.get(i).getName())
				{
					return this.DarkBlueList.get(i).getNumHouses();
				}
			}
		}
		
		return 0;
	}
	
	//Is the hotel build on this property?
	public boolean hasHotel(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				return this.DarkPurpleList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				return this.LightBlueList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				return this.LightPurpleList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				return this.OrangeList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				return this.RedList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				return this.GreenList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				return this.YellowList.get(i).hotelOwned();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				return this.DarkBlueList.get(i).hotelOwned();
		}
		return false;
	}
	public boolean hasHotel(String nameOfProperty, String color){
		if(color == "DarkPurple"){
			for(int i = 0;  i<this.DarkPurpleList.size() ; i++)
			{
				if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				{
					return this.DarkPurpleList.get(i).hotelOwned();
				}
			}
		}
		else if(color == "LightBlue"){
			for(int i = 0;  i<this.LightBlueList.size() ; i++)
			{
				if(nameOfProperty == this.LightBlueList.get(i).getName())
				{
					return this.LightBlueList.get(i).hotelOwned();
				}
			}
		}
		else if(color == "LightPurple"){
			for(int i = 0;  i<this.LightPurpleList.size() ; i++)
			{
				if(nameOfProperty == this.LightPurpleList.get(i).getName())
				{
					return this.LightPurpleList.get(i).hotelOwned();
				}
			}
		}
		else if(color == "Orange"){
			for(int i = 0;  i<this.OrangeList.size() ; i++)
			{
				if(nameOfProperty == this.OrangeList.get(i).getName())
				{
					return this.OrangeList.get(i).hotelOwned();
				}
			}
		}
			
		else if(color == "Red"){
			for(int i = 0;  i<this.RedList.size() ; i++)
			{
				if(nameOfProperty == this.RedList.get(i).getName())
				{
					return this.RedList.get(i).hotelOwned();
				}
			}
		}
		else if(color == "Green"){
			for(int i = 0;  i<this.GreenList.size() ; i++)
			{
				if(nameOfProperty == this.GreenList.get(i).getName())
				{
					return this.GreenList.get(i).hotelOwned();
				}
			}
		}
		else if(color == "Yellow"){
			for(int i = 0;  i<this.YellowList.size() ; i++)
			{
				if(nameOfProperty == this.YellowList.get(i).getName())
				{
					return this.YellowList.get(i).hotelOwned();
				}
			}
		}
		else if(color == "DarkBlue"){
			for(int i = 0;  i<this.DarkBlueList.size() ; i++)
			{
				if(nameOfProperty == this.DarkBlueList.get(i).getName())
				{
					return this.DarkBlueList.get(i).hotelOwned();
				}
			}
		}
		
		return false;
	}
	
	//returns the rentValue of the property or railroad
	public int getRentValue(String nameOfProperty, String color){
		if(color == "DarkPurple"){
			for(int i = 0;  i<this.DarkPurpleList.size() ; i++)
			{
				if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				{
					if(this.isDarkPurpleComplete() == false)
                        return this.DarkPurpleList.get(i).getRentValue();
                    else
                    {
                        if(isDarkPurpleComplete() == true
                                && this.getNumberOfHouses(this.DarkPurpleList.get(i).getName()) == 0
                                && this.hasHotel(this.DarkPurpleList.get(i).getName()) == false)
                            return this.DarkPurpleList.get(i).getRentValue()* 2;
                        else if(isDarkPurpleComplete() == true
                                && (this.getNumberOfHouses(this.DarkPurpleList.get(i).getName()) > 0
                                || this.hasHotel(this.DarkPurpleList.get(i).getName()) == true))
                            return this.DarkPurpleList.get(i).getRentValue();
                    }
				}
			}
		}
		else if(color == "LightBlue"){
			for(int i = 0;  i<this.LightBlueList.size() ; i++)
			{
				if(nameOfProperty == this.LightBlueList.get(i).getName())
				{
					if(isLightBlueComplete() == false)
                        return this.LightBlueList.get(i).getRentValue();
                    else
                    {
                        if(isLightBlueComplete() == true
                                && this.getNumberOfHouses(this.LightBlueList.get(i).getName()) == 0
                                && this.hasHotel(this.LightBlueList.get(i).getName()) == false)
                            return this.LightBlueList.get(i).getRentValue()* 2;
                        else if(isLightBlueComplete() == true
                                && (this.getNumberOfHouses(this.LightBlueList.get(i).getName()) > 0
                                || this.hasHotel(this.LightBlueList.get(i).getName()) == true))
                            return this.LightBlueList.get(i).getRentValue();
                    }
				}
			}
		}
		else if(color == "LightPurple"){
			for(int i = 0;  i<this.LightPurpleList.size() ; i++)
			{
				if(nameOfProperty == this.LightPurpleList.get(i).getName())
				{
					if(isLightPurpleComplete() == false)
                        return this.LightPurpleList.get(i).getRentValue();
                    else
                    {
                        if(isLightPurpleComplete() == true
                                && this.getNumberOfHouses(this.LightPurpleList.get(i).getName()) == 0
                                && this.hasHotel(this.LightPurpleList.get(i).getName()) == false)
                            return this.LightPurpleList.get(i).getRentValue()* 2;
                        else if(isLightPurpleComplete() == true
                                && (this.getNumberOfHouses(this.LightPurpleList.get(i).getName()) > 0
                                || this.hasHotel(this.LightPurpleList.get(i).getName()) == true))
                            return this.LightPurpleList.get(i).getRentValue();
                    }
				}
			}
		}
		else if(color == "Orange"){
			for(int i = 0;  i<this.OrangeList.size() ; i++)
			{
				if(nameOfProperty == this.OrangeList.get(i).getName())
				{
					if(isOrangeComplete() == false)
                        return this.OrangeList.get(i).getRentValue();
                    else
                    {
                        if(isOrangeComplete() == true
                                && this.getNumberOfHouses(this.OrangeList.get(i).getName()) == 0
                                && this.hasHotel(this.OrangeList.get(i).getName()) == false)
                            return this.OrangeList.get(i).getRentValue()* 2;
                        else if(isOrangeComplete() == true
                                && (this.getNumberOfHouses(this.OrangeList.get(i).getName()) > 0
                                || this.hasHotel(this.OrangeList.get(i).getName()) == true))
                            return this.OrangeList.get(i).getRentValue();
                    }
				}
			}
		}
			
		else if(color == "Red"){
			for(int i = 0;  i<this.RedList.size() ; i++)
			{
				if(nameOfProperty == this.RedList.get(i).getName())
				{
					if(isRedComplete() == false)
                        return this.RedList.get(i).getRentValue();
                    else
                    {
                        if(isRedComplete() == true
                                && this.getNumberOfHouses(this.RedList.get(i).getName()) == 0
                                && this.hasHotel(this.RedList.get(i).getName()) == false)
                            return this.RedList.get(i).getRentValue()* 2;
                        else if(isRedComplete() == true
                                && (this.getNumberOfHouses(this.RedList.get(i).getName()) > 0
                                || this.hasHotel(this.RedList.get(i).getName()) == true))
                            return this.RedList.get(i).getRentValue();
                    }
				}
			}
		}
		else if(color == "Green"){
			for(int i = 0;  i<this.GreenList.size() ; i++)
			{
				if(nameOfProperty == this.GreenList.get(i).getName())
				{
					if(isGreenComplete() == false)
                        return this.GreenList.get(i).getRentValue();
                    else
                    {
                        if(isGreenComplete() == true
                                && this.getNumberOfHouses(this.GreenList.get(i).getName()) == 0
                                && this.hasHotel(this.GreenList.get(i).getName()) == false)
                            return this.GreenList.get(i).getRentValue()* 2;
                        else if(isGreenComplete() == true
                                && (this.getNumberOfHouses(this.GreenList.get(i).getName()) > 0
                                || this.hasHotel(this.GreenList.get(i).getName()) == true))
                            return this.GreenList.get(i).getRentValue();
                    }
				}
			}
		}
		else if(color == "Yellow"){
            for(int i = 0;  i<this.YellowList.size() ; i++)
            {
                if(nameOfProperty == this.YellowList.get(i).getName())
                {
                    if(isYellowComplete() == false)
                        return this.YellowList.get(i).getRentValue();
                    else
                    {
                        if(isYellowComplete() == true
                                && this.getNumberOfHouses(this.YellowList.get(i).getName()) == 0
                                && this.hasHotel(this.YellowList.get(i).getName()) == false)
                            return this.YellowList.get(i).getRentValue()* 2;
                        else if(isYellowComplete() == true
                                && (this.getNumberOfHouses(this.YellowList.get(i).getName()) > 0
                                || this.hasHotel(this.YellowList.get(i).getName()) == true))
                            return this.YellowList.get(i).getRentValue();
                    }
                }
            }
        }

		else if(color == "DarkBlue"){
			for(int i = 0;  i<this.DarkBlueList.size() ; i++)
			{
				if(nameOfProperty == this.DarkBlueList.get(i).getName())
				{
					if(isDarkBlueComplete() == false)
                        return this.DarkBlueList.get(i).getRentValue();
                    else
                    {
                        if(isDarkBlueComplete() == true
                                && this.getNumberOfHouses(this.DarkBlueList.get(i).getName()) == 0
                                && this.hasHotel(this.DarkBlueList.get(i).getName()) == false)
                            return this.DarkBlueList.get(i).getRentValue()* 2;
                        else if(isDarkBlueComplete() == true
                                && (this.getNumberOfHouses(this.DarkBlueList.get(i).getName()) > 0
                                || this.hasHotel(this.DarkBlueList.get(i).getName()) == true))
                            return this.DarkBlueList.get(i).getRentValue();
                    }
				}
			}
		}
		
		return 0;
	}
	public int getRailroadRent(){
		//25, 50, 100,150
		int num = this.RailRoadList.size();
		if(num == 1)
			return 25;
		else if(num == 2)
			return 50;
		else if(num == 3)
			return 100;
		else if(num == 4)
			return 200;
		else return 0;
	}
	
	//getNumUtility() -- returns the number of utility cards(max is 2) the player owns
	public int getNumUtility(){
		return this.UtilityList.size();
	}
	

	public void buildHouse(String nameOfProperty, int numNewHouse){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName()){
				this.DarkPurpleList.get(i).addHouse(numNewHouse);
				
			}
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName()){
				this.LightBlueList.get(i).addHouse(numNewHouse);
				
			}
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName()){
				this.LightPurpleList.get(i).addHouse(numNewHouse);
				
				}
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName()){
				this.OrangeList.get(i).addHouse(numNewHouse);
				
			}
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName()){
				this.RedList.get(i).addHouse(numNewHouse);
				
			}
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName()){
				this.GreenList.get(i).addHouse(numNewHouse);
				
			}
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName()){
				this.YellowList.get(i).addHouse(numNewHouse);
				
			}
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName()){
				this.DarkBlueList.get(i).addHouse(numNewHouse);
				
			}
		}
	}
	public void removeHouse(String nameOfProperty, int numHouseRemoved){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName()){
				this.DarkPurpleList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName()){
				this.LightBlueList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName()){
				this.LightPurpleList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName()){
				this.OrangeList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName()){
				this.RedList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName()){
				this.GreenList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName()){
				this.YellowList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName()){
				this.DarkBlueList.get(i).removeHouse(numHouseRemoved);
				
			}
		}
	}
	public void buildHotel(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				this.DarkPurpleList.get(i).buildHotel();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				this.LightBlueList.get(i).buildHotel();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				this.LightPurpleList.get(i).buildHotel();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				this.OrangeList.get(i).buildHotel();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				this.RedList.get(i).buildHotel();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				this.GreenList.get(i).buildHotel();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				this.YellowList.get(i).buildHotel();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				this.DarkBlueList.get(i).buildHotel();
		}
	}
	public void removeHotel(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				this.DarkPurpleList.get(i).removeHotel();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				this.LightBlueList.get(i).removeHotel();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				this.LightPurpleList.get(i).removeHotel();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				this.OrangeList.get(i).removeHotel();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				this.RedList.get(i).removeHotel();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				this.GreenList.get(i).removeHotel();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				this.YellowList.get(i).removeHotel();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				this.DarkBlueList.get(i).removeHotel();
		}
	}
	//check if each color is complete or not
	public boolean isDarkPurpleComplete(){
			if(this.DarkPurpleList.size() == 2)
				return true;
			else
				return false;
		}
	public boolean isLightBlueComplete(){
			if(this.LightBlueList.size() == 3)
				return true;
			else
				return false;
		}
	public boolean isLightPurpleComplete(){
			if(this.LightPurpleList.size() == 3)
				return true;
			else
				return false;
		}
	public boolean isOrangeComplete(){
			if(this.OrangeList.size() == 3)
				return true;
			else
				return false;
		}
	public boolean isRedComplete(){
			if(this.RedList.size() == 3)
				return true;
			else
				return false;
		}
	public boolean isYellowComplete(){
			if(this.YellowList.size() == 3)
				return true;
			else
				return false;
		}
	public boolean isGreenComplete(){
			if(this.GreenList.size() == 3)
				return true;
			else
				return false;
		}
	public boolean isDarkBlueComplete(){
			if(this.DarkBlueList.size() == 2)
				return true;
			else
				return false;
		}
	public boolean isUtilityComplete(){
			if(this.UtilityList.size() == 2)
				return true;
			else
				return false;
		}
	public boolean isRailroadComplete(){
			if(this.RailRoadList.size() == 4)
				return true;
			else
				return false;
		}
		
	public int getDarkPurpleSize(){
		return this.DarkPurpleList.size(); 
	}
	public int getLightBlueSize(){
		return this.LightBlueList.size(); 
	}
	public int getLightPurpleSize(){
		return this.LightPurpleList.size(); 
	}
	public int getRedSize(){
		return this.RedList.size(); 
	}
	public int getOrangeSize(){
		return this.OrangeList.size(); 
	}
	public int getYellowSize(){
		return this.YellowList.size(); 
	}
	public int getGreenSize(){
		return this.GreenList.size(); 
	}
	public int getDarkBlueSize(){
		return this.DarkBlueList.size(); 
	}
	public int getUtilitySize(){
		return this.UtilityList.size(); 
	}
	public int getRailroadSize(){
		return this.RailRoadList.size(); 
	}
	
	//get the name of the property
	//loc = index of ArrayList
	public String getDarkPurpleNameAt(int loc){
		return this.DarkPurpleList.get(loc).getName();
	}
	public String getLightBlueNameAt(int loc){
		return this.LightBlueList.get(loc).getName(); 
	}
	public String getLightPurpleNameAt(int loc){
		return this.LightPurpleList.get(loc).getName(); 
	}
	public String getRedNameAt(int loc){
		return this.RedList.get(loc).getName();
	}
	public String getOrangeNameAt(int loc){
		return this.OrangeList.get(loc).getName(); 
	}
	public String getYellowNameAt(int loc){
		return this.YellowList.get(loc).getName(); 
	}
	public String getGreenNameAt(int loc){
		return this.GreenList.get(loc).getName();
	}
	public String getDarkBlueNameAt(int loc){
		return this.DarkBlueList.get(loc).getName();
	}
	public String getUtilityNameAt(int loc){
		return this.UtilityList.get(loc).getName();
	}
	public String getRailroadNameAt(int loc){
		return this.RailRoadList.get(loc).getName();
	}
	
	public int getBuildCost(String name){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(name == this.DarkPurpleList.get(i).getName())
				return this.DarkPurpleList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(name == this.LightBlueList.get(i).getName())
				return this.LightBlueList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(name == this.LightPurpleList.get(i).getName())
				return this.LightPurpleList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(name == this.OrangeList.get(i).getName())
				return this.OrangeList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(name == this.RedList.get(i).getName())
				return this.RedList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(name == this.GreenList.get(i).getName())
				return this.GreenList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(name == this.YellowList.get(i).getName())
				return this.YellowList.get(i).getBuildCost();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(name == this.DarkBlueList.get(i).getName())
				return this.DarkBlueList.get(i).getBuildCost();
		}
		return 0;
	}
	public int getTotalHouseNum(){
		int totalHouseNum = 0;
		if(this.isDarkPurpleComplete()){
			System.out.println("Darkperple1 -- " + this.getNumberOfHouses(this.getDarkPurpleNameAt(0)));
			System.out.println("Darkperple2 -- " + this.getNumberOfHouses(this.getDarkPurpleNameAt(1)));
			if(this.hasHotel(this.getDarkPurpleNameAt(0)) == false)
				totalHouseNum += this.getNumberOfHouses(this.getDarkPurpleNameAt(0));
			if(this.hasHotel(this.getDarkPurpleNameAt(1)) == false)
				totalHouseNum += this.getNumberOfHouses(this.getDarkPurpleNameAt(1));
		}
		if(this.isLightBlueComplete()){
			System.out.println("lightblue1 -- " + this.getNumberOfHouses(this.getLightBlueNameAt(0)));
			System.out.println("lightblue2 -- " + this.getNumberOfHouses(this.getLightBlueNameAt(1)));
			System.out.println("lightblue3 -- " + this.getNumberOfHouses(this.getLightBlueNameAt(2)));
			if(this.hasHotel(this.getLightBlueNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getLightBlueNameAt(0));
			if(this.hasHotel(this.getLightBlueNameAt(1)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getLightBlueNameAt(1));
			if(this.hasHotel(this.getLightBlueNameAt(2)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getLightBlueNameAt(2));
		}
		if(this.isLightPurpleComplete()){
			System.out.println("LightPurple1 -- " + this.getNumberOfHouses(this.getLightPurpleNameAt(0)));
			System.out.println("LightPurple2 -- " + this.getNumberOfHouses(this.getLightPurpleNameAt(1)));
			System.out.println("LightPurple3 -- " + this.getNumberOfHouses(this.getLightPurpleNameAt(2)));
			if(this.hasHotel(this.getLightPurpleNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getLightPurpleNameAt(0));
			if(this.hasHotel(this.getLightPurpleNameAt(1)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getLightPurpleNameAt(1));
			if(this.hasHotel(this.getLightPurpleNameAt(2)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getLightPurpleNameAt(2));
		}
		if(this.isOrangeComplete()){
			System.out.println("Orange1 -- " + this.getNumberOfHouses(this.getOrangeNameAt(0)));
			System.out.println("Orange2 -- " + this.getNumberOfHouses(this.getOrangeNameAt(1)));
			System.out.println("Orange3 -- " + this.getNumberOfHouses(this.getOrangeNameAt(2)));
			if(this.hasHotel(this.getOrangeNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getOrangeNameAt(0));
			if(this.hasHotel(this.getOrangeNameAt(1)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getOrangeNameAt(1));
			if(this.hasHotel(this.getOrangeNameAt(2)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getOrangeNameAt(2));
		}
		if(this.isRedComplete()){
			System.out.println("Red1 -- " + this.getNumberOfHouses(this.getRedNameAt(0)));
			System.out.println("Red2 -- " + this.getNumberOfHouses(this.getRedNameAt(1)));
			System.out.println("Red3 -- " + this.getNumberOfHouses(this.getRedNameAt(2)));
			if(this.hasHotel(this.getRedNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getRedNameAt(0));
			if(this.hasHotel(this.getRedNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getRedNameAt(1));
			if(this.hasHotel(this.getRedNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getRedNameAt(2));
		}
		if(this.isYellowComplete()){
			System.out.println("Yellow1 -- " + this.getNumberOfHouses(this.getYellowNameAt(0)));
			System.out.println("Yellow2 -- " + this.getNumberOfHouses(this.getYellowNameAt(1)));
			System.out.println("Yellow3 -- " + this.getNumberOfHouses(this.getYellowNameAt(2)));
			if(this.hasHotel(this.getYellowNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getYellowNameAt(0));
			if(this.hasHotel(this.getYellowNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getYellowNameAt(1));
			if(this.hasHotel(this.getYellowNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getYellowNameAt(2));
		}
		if(this.isGreenComplete()){
			System.out.println("Green1 -- " + this.getNumberOfHouses(this.getGreenNameAt(0)));
			System.out.println("Green2 -- " + this.getNumberOfHouses(this.getGreenNameAt(1)));
			System.out.println("Green3 -- " + this.getNumberOfHouses(this.getGreenNameAt(2)));
			if(this.hasHotel(this.getGreenNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getGreenNameAt(0));
			if(this.hasHotel(this.getGreenNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getGreenNameAt(1));
			if(this.hasHotel(this.getGreenNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getGreenNameAt(2));
		}
		if(this.isDarkBlueComplete()){
			System.out.println("DarkBlue1 -- " + this.getNumberOfHouses(this.getDarkBlueNameAt(0)));
			System.out.println("DarkBlue2 -- " + this.getNumberOfHouses(this.getDarkBlueNameAt(1)));
			
			if(this.hasHotel(this.getDarkBlueNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getDarkBlueNameAt(0));
			if(this.hasHotel(this.getDarkBlueNameAt(0)) == false);
				totalHouseNum += this.getNumberOfHouses(this.getDarkBlueNameAt(1));
		
		}
		return totalHouseNum;
	}
	public int getTotalHotelNum(){
		int totalHotelNum = 0;
		if(this.isDarkPurpleComplete()){
			for(int i = 0; i < this.getDarkPurpleSize(); i++){
				if(this.hasHotel(this.getDarkPurpleNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isLightBlueComplete()){
			for(int i = 0; i < this.getLightBlueSize(); i++){
				if(this.hasHotel(this.getLightBlueNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isLightPurpleComplete()){
			for(int i = 0; i < this.getLightPurpleSize(); i++){
				if(this.hasHotel(this.getLightPurpleNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isOrangeComplete()){
			for(int i = 0; i < this.getOrangeSize(); i++){
				if(this.hasHotel(this.getOrangeNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isRedComplete()){
			for(int i = 0; i < this.getRedSize(); i++){
				if(this.hasHotel(this.getRedNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isYellowComplete()){
			for(int i = 0; i < this.getYellowSize(); i++){
				if(this.hasHotel(this.getYellowNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isGreenComplete()){
			for(int i = 0; i < this.getGreenSize(); i++){
				if(this.hasHotel(this.getGreenNameAt(i)))
					totalHotelNum++;
			}
		}
		if(this.isDarkBlueComplete()){
			for(int i = 0; i < this.getDarkBlueSize(); i++){
				if(this.hasHotel(this.getDarkBlueNameAt(i)))
					totalHotelNum++;
			}
		}
		return totalHotelNum;
	}
	
	public boolean checkGroups()
	{
	   	 if(this.isDarkPurpleComplete() == true)
	   	 {
	   		 groups[0] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isLightBlueComplete() == true)
	   	 {
	   		 groups[1] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isLightPurpleComplete() == true)
	   	 {
	   		 groups[2] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isOrangeComplete() == true)
	   	 {
	   		 groups[3] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isRedComplete() == true)
	   	 {
	   		 groups[4] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isYellowComplete() == true)
	   	 {
	   		 groups[5] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isGreenComplete() == true)
	   	 {
	   		 groups[6] = 1;
	   		 return true;
	   	 }
	   	 else if(this.isDarkBlueComplete() == true)
	   	 {
	   		 groups[7] = 1;
	   		 return true;
	   	 }
	   	 return false;
   }
	
	public boolean isMortgaged(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				return this.DarkPurpleList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				return this.LightBlueList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				return this.LightPurpleList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				return this.OrangeList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				return this.RedList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				return this.GreenList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				return this.YellowList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				return this.DarkBlueList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.UtilityList.size() ; i++){
			if(nameOfProperty == this.UtilityList.get(i).getName())
				return this.UtilityList.get(i).isMortgaged();
		}
		for(int i = 0; i<this.RailRoadList.size() ; i++){
			if(nameOfProperty == this.RailRoadList.get(i).getName())
				return this.RailRoadList.get(i).isMortgaged();
		}
		
		return false;
	}
	public void mortgage(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName())
				this.DarkPurpleList.get(i).mortgage();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				this.LightBlueList.get(i).mortgage();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				this.LightPurpleList.get(i).mortgage();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				this.OrangeList.get(i).mortgage();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				this.RedList.get(i).mortgage();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				this.GreenList.get(i).mortgage();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				this.YellowList.get(i).mortgage();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				this.DarkBlueList.get(i).mortgage();
		}
		for(int i = 0; i<this.UtilityList.size() ; i++){
			if(nameOfProperty == this.UtilityList.get(i).getName())
				this.UtilityList.get(i).mortgage();
		}
		for(int i = 0; i<this.RailRoadList.size() ; i++){
			if(nameOfProperty == this.RailRoadList.get(i).getName())
				this.RailRoadList.get(i).mortgage();
		}
		
	}
	public void unmortgage(String nameOfProperty){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(nameOfProperty == this.DarkPurpleList.get(i).getName()){
				this.DarkPurpleList.get(i).unmortgage();
				System.out.println("unmortgaging ");
			}
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(nameOfProperty == this.LightBlueList.get(i).getName())
				this.LightBlueList.get(i).unmortgage();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(nameOfProperty == this.LightPurpleList.get(i).getName())
				this.LightPurpleList.get(i).unmortgage();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(nameOfProperty == this.OrangeList.get(i).getName())
				this.OrangeList.get(i).unmortgage();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(nameOfProperty == this.RedList.get(i).getName())
				this.RedList.get(i).unmortgage();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(nameOfProperty == this.GreenList.get(i).getName())
				this.GreenList.get(i).unmortgage();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(nameOfProperty == this.YellowList.get(i).getName())
				this.YellowList.get(i).unmortgage();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(nameOfProperty == this.DarkBlueList.get(i).getName())
				this.DarkBlueList.get(i).unmortgage();
		}
		for(int i = 0; i<this.UtilityList.size() ; i++){
			if(nameOfProperty == this.UtilityList.get(i).getName())
				this.UtilityList.get(i).unmortgage();
		}
		for(int i = 0; i<this.RailRoadList.size() ; i++){
			if(nameOfProperty == this.RailRoadList.get(i).getName())
				this.RailRoadList.get(i).unmortgage();
		}
	}
	
	public int getMortgageValue(String name){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(name == this.DarkPurpleList.get(i).getName())
				return this.DarkPurpleList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(name == this.LightBlueList.get(i).getName())
				return this.LightBlueList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(name == this.LightPurpleList.get(i).getName())
				return this.LightPurpleList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(name == this.OrangeList.get(i).getName())
				return this.OrangeList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(name == this.RedList.get(i).getName())
				return this.RedList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(name == this.GreenList.get(i).getName())
				return this.GreenList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(name == this.YellowList.get(i).getName())
				return this.YellowList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(name == this.DarkBlueList.get(i).getName())
				return this.DarkBlueList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.UtilityList.size();i++){
			if(name == this.UtilityList.get(i).getName())
				return this.UtilityList.get(i).getMortgageValue();
		}
		for(int i = 0; i<this.RailRoadList.size();i++){
			if(name == this.RailRoadList.get(i).getName())
				return this.RailRoadList.get(i).getMortgageValue();
		}
		return 0;
	}
	
	public int getPrice(String name){
		for(int i = 0; i<this.DarkPurpleList.size() ; i++){
			if(name == this.DarkPurpleList.get(i).getName())
				return this.DarkPurpleList.get(i).getPrice();
		}
		for(int i = 0; i<this.LightBlueList.size() ; i++){
			if(name == this.LightBlueList.get(i).getName())
				return this.LightBlueList.get(i).getPrice();
		}
		for(int i = 0; i<this.LightPurpleList.size() ; i++){
			if(name == this.LightPurpleList.get(i).getName())
				return this.LightPurpleList.get(i).getPrice();
		}
		for(int i = 0; i<this.OrangeList.size() ; i++){
			if(name == this.OrangeList.get(i).getName())
				return this.OrangeList.get(i).getPrice();
		}
		for(int i = 0; i<this.RedList.size() ; i++){
			if(name == this.RedList.get(i).getName())
				return this.RedList.get(i).getPrice();
		}
		for(int i = 0; i<this.GreenList.size() ; i++){
			if(name == this.GreenList.get(i).getName())
				return this.GreenList.get(i).getPrice();
		}
		for(int i = 0; i<this.YellowList.size() ; i++){
			if(name == this.YellowList.get(i).getName())
				return this.YellowList.get(i).getPrice();
		}
		for(int i = 0; i<this.DarkBlueList.size() ; i++){
			if(name == this.DarkBlueList.get(i).getName())
				return this.DarkBlueList.get(i).getPrice();
		}
		return 0;
	}
} // end class Player